function FillTaskForm()
{
	var nodeStateInfo=jQuery("#speed-test-state-info");
	var nodeStateDescription=jQuery("#speed-test-description");	

	var taskFactory = new TaskFactory();
	
	var plotUpload = new Plot();
	var plotUploadSpeed = new Plot();
	var plotDownload = new Plot();
	var plotDownloadSpeed = new Plot();
	

	var timeoutInterval = 1000; // 1 second
	var timeoutID = 'undefined';

	var fillStateInformationsTd = function(szTitle, szDateStart, szDateEnd, szSizeCopied, szElaspedTime, szAverageSpeed, szStatus)
	{
		var result = '<tr>';

		result += '<td>'+szTitle+'</td>';
		result += '<td>'+szDateStart+'</td>';
		result += '<td>'+szDateEnd+'</td>';
		result += '<td>'+szSizeCopied+'</td>';
		result += '<td>'+szElaspedTime+'</td>';
		result += '<td>'+szAverageSpeed+'</td>';
		result += '<td>'+FillStatus.print(szStatus)+'</td>';

		result += '</tr>';

		nodeStateInfo.append(result);
	};


	var fillStateInformations = function(dataResult)
	{
		nodeStateInfo.html("");
		jQuery.each(dataResult.listUpload, function( index, value ) {

			fillStateInformationsTd(
					value.title, 
					value.dateStart, 
					value.dateEnd, 
					value.sizeCopied, 
					Converter.ElapsedTimeToHumanReadable(value.elaspedTime),
					value.averageSpeed,
					value.status
			);
		});
		
		jQuery.each(dataResult.listDownload, function( index, value ) {

			fillStateInformationsTd(
					value.title, 
					value.dateStart, 
					value.dateEnd, 
					value.sizeCopied, 
					Converter.ElapsedTimeToHumanReadable(value.elaspedTime),
					value.averageSpeed,
					value.status
			);
		});
		
	};


	var fill = function(szJobName, taskId)
	{
		dataResult=taskFactory.loadTask(szJobName, taskId);

		nodeStateDescription.html(dataResult.scenarioList.description);	
		fillStateInformations(dataResult.scenarioList);
		
		// upload:
		plot_array = taskFactory.fillPlotArray(dataResult.scenarioList.listUpload);
		plotUpload.redraw(plot_array, 'chart-avgSpeed-upload', 'UPLOAD - average speed (Mo/s)');		

		plot_array_speed=taskFactory.getSpeed(dataResult.scenarioList.listUpload);
		plotUploadSpeed.redraw(plot_array_speed, 'chart-speed-upload', 'UPLOAD - speed (Mo/s)');

		// download:
		plot_array = taskFactory.fillPlotArray(dataResult.scenarioList.listDownload);
		plotDownload.redraw(plot_array, 'chart-avgSpeed-download', 'DOWNLOAD - average speed (Mo/s)');		

		plot_array_speed=taskFactory.getSpeed(dataResult.scenarioList.listDownload);
		plotDownloadSpeed.redraw(plot_array_speed, 'chart-speed-download', 'DOWNLOAD - speed (Mo/s)');
		
		return dataResult;
	};

	this.engine = function(szJobName, taskId)
	{
		var dataResult = fill(szJobName, taskId);

		///////////////////// RUNNING //////////////////////////

		var tesCheckTimeoutStop = function()
		{
			window.clearInterval(timeoutID);			
			fill(szJobName, taskId);
		};

		var tesCheckTimeoutFunction = function()
		{
			var dataResult = taskFactory.loadTask(szJobName, taskId);

			if(!dataResult.running)
			{			
				tesCheckTimeoutStop();
			}
			else
			{
				nodeStateDescription.html(dataResult.scenarioList.description);
				fillStateInformations(dataResult.scenarioList);
				
				// upload:
				plot_array = taskFactory.fillPlotArray(dataResult.scenarioList.listUpload);
				plotUpload.redraw(plot_array, 'chart-avgSpeed-upload', 'UPLOAD - average speed (Mo/s)', false);		

				plot_array_speed=taskFactory.getSpeed(dataResult.scenarioList.listUpload);
				plotUploadSpeed.redraw(plot_array_speed, 'chart-speed-upload', 'UPLOAD - speed (Mo/s)', false);

				// download:
				plot_array = taskFactory.fillPlotArray(dataResult.scenarioList.listDownload);
				plotDownload.redraw(plot_array, 'chart-avgSpeed-download', 'DOWNLOAD - average speed (Mo/s)', false);		

				plot_array_speed=taskFactory.getSpeed(dataResult.scenarioList.listDownload);
				plotDownloadSpeed.redraw(plot_array_speed, 'chart-speed-download', 'DOWNLOAD - speed (Mo/s)', false);
			}
		};



		if(dataResult.running)
		{ // task is running
			timeoutID = window.setInterval(tesCheckTimeoutFunction, timeoutInterval);
		}
	};
}